package com.health.db.dao.user.impl;
 
import java.util.List;

import com.health.db.dao.ServiceInterface;
import com.health.db.dao.user.IStuffRecommondDao;
import com.health.db.dto.DoctorListDto;
import com.health.db.mapper.StuffRecommondMapper;
import com.health.redis.RedisConstants;


public class StuffRecommondDaoImpl extends ServiceInterface implements IStuffRecommondDao {

	StuffRecommondMapper stuffRecommondMapper;

	public StuffRecommondMapper getStuffRecommondMapper() {
		return stuffRecommondMapper;
	}

	public void setStuffRecommondMapper(StuffRecommondMapper stuffRecommondMapper) {
		this.stuffRecommondMapper = stuffRecommondMapper;
	}

	/**
	 * 无参数全表查询
	 */
	@Override
	public List<DoctorListDto> selectAllRecommond() {
		// TODO Auto-generated method stub
		
		getRedisOperatiorLogic();
     	String key=RedisConstants.StuffRecommondMapper;
     	Object object=null;
     	 List<DoctorListDto>  list=null; 
     
		 if(redisOperatiorLogic.isJedisIsConnected())
		 {
			 object=redisOperatiorLogic.readObject(key, getOrderRedisGroupNo("1"));
		 }
		 if(null!=object)
		 {
			 if ( !"".equals(object)) {
				 list=(List<DoctorListDto>) object;
			}
		 }
		 else
		 {
			 list = stuffRecommondMapper.selectAllRecommond();
			if(redisOperatiorLogic.isJedisIsConnected())
			 {
			 redisOperatiorLogic.setEx(key, list, getOrderRedisGroupNo("1"));
			 }
		 }
        return  list;
	}
}
